# 列表推导式
# 字典推导式
# 集合推导式
# 生成器推导式 （注意：不直接生成元组）

print([x for x in range(1,5)])
print([x*2 for x in range(1,5)])
print([x*2 for x in range(1,20) if x%5==0])
print([a for a in "abcdef"])
cells = [(row,col) for row,col in zip(range(1,10),range(101,110))]
print(list(zip(range(1,10),range(101,110))))
print(dict(zip(range(1,10),range(101,110))))
print(cells)
for cell in cells:
    print(cell)


values = ["北京", "上海", "深圳", "广州"]
cities = {id*100:city for id, city in zip(range(1,5), values)}
print(cities)

## 示例：统计一段文字中各字符的出现次数
my_test = 'I love you, i love sxt, i love python'
stat = {c:my_test.count(c) for c in my_test}
print(stat)